package com.sc.VenusQueryBeta.adapter.account;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sc.VenusQueryBeta.R;
import com.sc.VenusQueryBeta.adapter.BaseCompatAdapter;
import com.sc.VenusQueryBeta.model.bean.account.DaiShuBean;


/**
 * Created by Administrator on 2018/10/16.
 *
 */

public class DaiShuAdapter extends BaseCompatAdapter<DaiShuBean.ListBean, BaseViewHolder> {
    public DaiShuAdapter(int layoutResId,  DaiShuBean daiShuBean) {
        super(layoutResId, daiShuBean.getList());
    }

    public DaiShuAdapter(int item_daishumx) {
        super(item_daishumx);
    }

    @Override
    protected void convert(BaseViewHolder helper, DaiShuBean.ListBean item) {
        helper.setText(R.id.tv_username_daishu,item.getClientid());
        helper.setText(R.id.tv_single_number,item.getFormid());
        String Loannum = String.valueOf(item.getLoannum());
        helper.setText(R.id.tv_money,Loannum+"萬");//尚欠金额
     //   helper.setText(R.id.tv_time,item.getSettime());//贷款时间
//        helper.setText(R.id.tv_time_out,formatDate(item.getExpireddate()));//到期时间
        String Balance = String.valueOf(item.getBalance());
        helper.setText(R.id.tv_daishu,Balance+"萬");//贷续金额
     //   helper.setText(R.id.tv_time_money,item.getRedemptionLoanTime());//贷续时间


        //贷款时间
        String year = item.getSettime().substring(0,4);
        String month = item.getSettime().substring(4,6);
        String day = item.getSettime().substring(6,8);
        String hour = item.getSettime().substring(8,10);
        String min = item.getSettime().substring(10);
        String date = year+"-"+month+"-"+day+" "+hour+":"+min;
        helper.setText(R.id.tv_time,date);
        //到期时间
        String year1 = item.getExpireddate().substring(0,4);
        String month1 = item.getExpireddate().substring(4,6);
        String day1 = item.getExpireddate().substring(6,8);
        String hour1 = item.getExpireddate().substring(8,10);
        String min1 = item.getExpireddate().substring(10);
        String date1 = year1+"-"+month1+"-"+day1+" "+hour1+":"+min1;
        helper.setText(R.id.tv_time_out,date1);
        //贷赎时间
        String year2 = item.getRedemptionLoanTime().substring(0,4);
        String month2 = item.getRedemptionLoanTime().substring(4,6);
        String day2 = item.getRedemptionLoanTime().substring(6,8);
        String hour2 = item.getRedemptionLoanTime().substring(8,10);
        String min2 = item.getRedemptionLoanTime().substring(10);
        String date2 = year2+"-"+month2+"-"+day2+" "+hour2+":"+min2;
        helper.setText(R.id.tv_time_money,date2);
    }
}
